package com.wangsd.common.enums;

public enum ButtonType {

    ADD("add", "新增"),
    QUERY("query", "查询"),
    UPDATE("update", "修改"),
    DELETE("delete", "删除"),
    IMPORT("import", "导入"),
    export("export", "导出"),
    other("other", "特殊");

    private String code;
    private String value;

    ButtonType(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValueByCode(String code) {
        ButtonType[] values = ButtonType.values();
        for (ButtonType type : values) {
            if (type.code.equalsIgnoreCase(code)) {
                return type.value;
            }
        }
        return null;
    }

    public static String getCodeByValue(String value) {
        ButtonType[] values = ButtonType.values();
        for (ButtonType type : values) {
            if (type.value.equalsIgnoreCase(value)) {
                return type.code;
            }
        }
        return null;
    }

}
